- Ergebnisse inferenzstatistischer Tests interpretieren können
- Erster Überblick über unterschiedliche inferenzstatistischen Tests
- Effekstärke t-Test berechnen können
- Voraussetzungen inferenzstatistischer Tests kennen (t-Test)
25. Mai 2020
Schauen Sie nochmals die zwei vorbereitenden Aufgaben durch:
Schauen Sie nochmals in den Artikel von Harks & Hannover, (2020):
Was fällt Ihnen zur Hypothese, den dazugehörigen Auswertungen und daraus abgeleiteten Interpretationen auf?
Siehe auch ausführlichere Tabelle auf Moodle
t.test(formula = mpg ~ am, # frequentistischer t-Test
data = mtcars,
var.equal = T)
## ## Two Sample t-test ## ## data: mpg by am ## t = -4.1061, df = 30, p-value = 0.000285 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -10.84837 -3.64151 ## sample estimates: ## mean in group 0 mean in group 1 ## 17.14737 24.39231
# die Funktion `cohen.d` befindet sich im Paket `effsize`
install.packages("effsize") # Paket installieren (nur 1x)
library(effsize) # nach jedem Neustart von R Paket laden
cohen.d(formula = mpg ~ am,
data = mtcars)
## ## Cohen's d ## ## d estimate: -1.477947 (large) ## 95 percent confidence interval: ## lower upper ## -2.304209 -0.651685
| group | test | ID |
|---|---|---|
| Experimentalgruppe | 3.195 | Ayse |
| Experimentalgruppe | 1.88 | Bertram |
| Experimentalgruppe | 2.499 | Caroline |
| Experimentalgruppe | 2.667 | Daniel |
| Kontrollgruppe | 2.353 | Erhan |
| Kontrollgruppe | 1.607 | Frank |
| Kontrollgruppe | 3.149 | Gert |
| Kontrollgruppe | 2.499 | Hannah |
| group | test | ID |
|---|---|---|
| Experimentalgruppe | 3.195 | Ayse |
| Experimentalgruppe | 1.88 | Bertram |
| Experimentalgruppe | 2.499 | Caroline |
| Experimentalgruppe | 2.667 | Daniel |
| Kontrollgruppe | 2.353 | Erhan |
| Kontrollgruppe | 1.607 | Frank |
| Kontrollgruppe | 3.149 | Gert |
| Kontrollgruppe | 2.499 | Hannah |
| ID | Vortest | Nachtest |
|---|---|---|
| Ayse | 1.409 | 3.736 |
| Bertram | 2.567 | 1.675 |
| Caroline | 2.992 | 2.515 |
| Daniel | 3.495 | 1.803 |
# unabhängige Stichproben
t.test(formula = mpg ~ am,
data = mtcars,
paired = FALSE)
# abhängige Stichproben
t.test(x = mtcars$mpg,
y = mtcars$am,
paired = TRUE)
# eine Stichprobe
t.test(x = mtcars$mpg,
mu = 0)# die Funktion `leveneTest` befindet sich im Paket `car`
install.packages("car") # Paket installieren (nur 1x)
library(car) # nach jedem Neustart von R Paket laden
leveneTest(y = mpg ~ as.factor(am), # der Levene test möchte, dass am hier als Faktor definiert wird
data = mtcars)
## Levene's Test for Homogeneity of Variance (center = median) ## Df F value Pr(>F) ## group 1 4.1876 0.04957 * ## 30 ## --- ## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# keine Installation von Paketen nötig
# ks.test() ist bereits vorinstalliert und geladen
ks.test(x = mtcars$mpg, # welche Variable soll getestet werden?
y = "pnorm", # welche Verteilung interessiert uns? Hier Normalverteilung: "pnorm"
mean(mtcars$mpg), # wie ist der Mittelwert der Variable?
sd(mtcars$mpg)) # wie ist die Standardabweichung der Variable?
## ## One-sample Kolmogorov-Smirnov test ## ## data: mtcars$mpg ## D = 0.1263, p-value = 0.687 ## alternative hypothesis: two-sided
ks.test(x = mtcars$mpg[mtcars$am == 0], # welche Variable soll getestet werden?
y = "pnorm", # welche Verteilung interessiert uns? Hier Normalverteilung: "pnorm"
mean(mtcars$mpg[mtcars$am == 0]), # wie ist der Mittelwert der Variable?
sd(mtcars$mpg[mtcars$am == 0])) # wie ist die Standardabweichung der Variable?
## ## One-sample Kolmogorov-Smirnov test ## ## data: mtcars$mpg[mtcars$am == 0] ## D = 0.087337, p-value = 0.9987 ## alternative hypothesis: two-sided
ks.test(x = mtcars$mpg[mtcars$am == 1], # welche Variable soll getestet werden?
y = "pnorm", # welche Verteilung interessiert uns? Hier Normalverteilung: "pnorm"
mean(mtcars$mpg[mtcars$am == 1]), # wie ist der Mittelwert der Variable?
sd(mtcars$mpg[mtcars$am == 1])) # wie ist die Standardabweichung der Variable?
## ## One-sample Kolmogorov-Smirnov test ## ## data: mtcars$mpg[mtcars$am == 1] ## D = 0.14779, p-value = 0.939 ## alternative hypothesis: two-sided
# klassischer t-Test für unabhängige Stichproben
t.test(formula = mpg ~ am,
data = mtcars,
paired = FALSE,
var.equal = TRUE) # Varianzen gleich
## ## Two Sample t-test ## ## data: mpg by am ## t = -4.1061, df = 30, p-value = 0.000285 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -10.84837 -3.64151 ## sample estimates: ## mean in group 0 mean in group 1 ## 17.14737 24.39231
# klassischer t-Test für unabhängige Stichproben
t.test(formula = mpg ~ am,
data = mtcars,
paired = FALSE,
var.equal = TRUE) # Varianzen gleich
## ## Two Sample t-test ## ## data: mpg by am ## t = -4.1061, df = 30, p-value = 0.000285 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -10.84837 -3.64151 ## sample estimates: ## mean in group 0 mean in group 1 ## 17.14737 24.39231
# Welch Test
t.test(formula = mpg ~ am,
data = mtcars,
paired = FALSE,
var.equal = FALSE) # Varianzen ungleich
## ## Welch Two Sample t-test ## ## data: mpg by am ## t = -3.7671, df = 18.332, p-value = 0.001374 ## alternative hypothesis: true difference in means is not equal to 0 ## 95 percent confidence interval: ## -11.280194 -3.209684 ## sample estimates: ## mean in group 0 mean in group 1 ## 17.14737 24.39231